<%@ include file="/en/jsp/static.jsp" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="Common" %>
<%
  String SORTBY = "fromtime";
%>

<jsp:include page="/en/jsp/header.jsp" flush="true"/>
<table width="100%" border=0 cellpadding=0 cellspacing=0>
<tr><td>

<script Language="JavaScript">
  function confirmDel(entry)
  {
    return confirm("Are you sure to delete " + entry);
  }
</script>

<FORM action="<%=BoxStatic.servletDir%>BoxReservationAction" method="POST">
  <input type="submit" name="SubmitAdd" value="Make a new reservation">
  <jsp:useBean id="home" class="linuxbox.resource.logic.BoxResource"/>

  <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 bgColor=#dddddd>
    <TR>
      <TH bgColor=#f4f5e1><a href="<%=BoxStatic.servletDir%>BoxReservationAction?SubmitSort=sort&SORTBY=name">Name</a></TH>
      <TH bgColor=#f4f5e1><a href="<%=BoxStatic.servletDir%>BoxReservationAction?SubmitSort=sort&SORTBY=category">Category</a></TH>
      <TH bgColor=#f4f5e1><a href="<%=BoxStatic.servletDir%>BoxReservationAction?SubmitSort=sort&SORTBY=location">Location</a></TH>
      <TH bgColor=#f4f5e1>Description</TH>
      <TH bgColor=#f4f5e1>Allow People</TH>
    </TR>
<%
  java.util.Iterator it = home.getAllResources(SORTBY);
  if ( it != null && it.hasNext())
  {
%>
    <Common:Iteration name="entry" type="linuxbox.resource.logic.BoxResourceEntry" group="<%=it%>">
      <TR>
        <TD bgColor=#eeeeee><a href="<%=BoxStatic.servletDir%>BoxResourceAction?ID=<%=entry.getID()%>"><%=entry.getName()%></a>
          <a href="<%=BoxStatic.servletDir%>BoxResourceAction?SubmitDelete=del&ID=<%=entry.getID()%>">
            <img SRC="<%=BoxStatic.imageDir%>cal_del.gif" WIDTH="12" HEIGHT="12" BORDER="0"
              Onclick='return confirmDel("<%=entry.getName()%>")'
              ALT="Delete">
          </a>
        </TD>
        <TD bgColor=#eeeeee><!--%=entry.getCategoryString(entry.getCategory())%--></TD>
        <TD bgColor=#eeeeee><%=entry.getLocation()%></TD>
        <TD bgColor=#eeeeee><%=entry.getDescription()%></TD>
        <TD bgColor=#eeeeee><%=entry.getAllowPeople()%></TD>
      </TR>
    </Common:Iteration>
<%
  }
%>
  </TABLE>


</FORM>
</td></tr>
</table>
<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
